<?
    require_once("mvc/action/ActionForm.php");
    require_once("mvc/action/ActionMessage.php");
    require_once("mvc/action/ActionMessages.php");

    require_once("cms/forum/om/TopicReply.php");


    class BaseReplyForm extends ActionForm {

        protected $reply;

        public function __construct() {
            $this->reply = new TopicReply();
        }

        public function getReply() {
            return $this->reply;
        }

        public function setReply(TopicReply $reply) {
            $this->reply = $reply;
        }

        public function validate() {

            $errors = new ActionMessages();

            if(is_null($this->getReply()->getBody()) || strlen($this->getReply()->getBody()) == 0)
                $errors->add("reply->body",
                    new ActionMessage("errors.required", true, new ActionMessage("prompt.body", true)));


            return $errors;
        }

    }
?>